package com.hzyl.famousreader.view.adapter;

import android.support.annotation.Nullable;
import android.widget.FrameLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hzyl.famousreader.R;
import com.hzyl.famousreader.view.widget.core.model.ReadBackground;

import java.util.List;

/**
 * 阅读背景
 */
public class ReadBgAdapter extends BaseQuickAdapter<ReadBackground, BaseViewHolder> {

  public ReadBgAdapter(@Nullable List<ReadBackground> data) {
    super(R.layout.item_read_bg, data);
  }

  @Override
  protected void convert(BaseViewHolder helper, ReadBackground item) {
    FrameLayout frameLayout = helper.getView(R.id.read_bg_wrapper);
    frameLayout.setBackground(mContext.getResources().getDrawable(R.drawable.shape_btn_read_setting_normal));
    helper.setBackgroundColor(R.id.read_bg_view, item.getReadTheme().getBgColor());
    helper.setVisible(R.id.read_bg_iv_checked, item.isSelected());
  }
}
